
import math
def main():
   myMessage= '计学2班算与0机技0科术1'
   myKey = 4
   plaintext = decrypt(myKey, myMessage)
   print(plaintext+"|")
def decrypt(key, message):
   numOfColumns = math.ceil(len(message) / key)  #列
   numOfRows = key
   numOfShadedBoxes = (numOfColumns * numOfRows) - len(message)
   plaintext = [""] * numOfColumns
   col = 0
   row = 0
   for symbol in message:
      plaintext[col] += symbol
      col += 1
      if (col == numOfColumns) or (col == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes):
          col = 0 
          row += 1 
         
   return ''.join(plaintext)
if __name__ == '__main__':
   main()